"""
This module demonstrates handling custom exceptions and basic logging.

"""

import logging


class CustomException(Exception):
    """
    CustomException is an example of a custom exception.

    Attributes:
        message (str): Explanation of the error.
    """

    def __init__(self, message):
        """
        Initialize CustomException with an error message.

        Args:
            message (str): Explanation of the error.
        """
        super().__init__(message)
        self.message = message


def function_with_logging():
    """
    A function that demonstrates basic logging and exception handling.

    Raises:
        CustomException: If an error condition occurs.

    Returns:
        str: Success message if no exceptions are raised.
    """
    try:
        logging.info("Starting function_with_logging")
        # Simulate an error
        raise CustomException("An error occurred in function_with_logging")
    except CustomException as e:
        logging.error(f"CustomException: {e.message}")
        return f"Error handled: {e.message}"
    finally:
        logging.info("function_with_logging completed")
